import request from '@/utils/request'

/**
 * 获取所有标签，不分页
 * @returns
 */
export const getAllTagsAPI = () => {
  return request({
    url: '/tag/all',
    method: 'get',
  })
}

/**
 * 获取标签列表，分页
 */
export const getTagListAPI = (params) => {
  return request({
    url: '/tag',
    method: 'get',
    params,
  })
}

/**
 * 创建标签
 */
export const createTagAPI = (data) => {
  return request({
    url: '/tag',
    method: 'post',
    data,
  })
}

/**
 * 更新标签
 */
export const updateTagAPI = (data) => {
  return request({
    url: `/tag/${data.id}`,
    method: 'put',
    data,
  })
}

/**
 * 删除标签
 */
export const deleteTagAPI = (id) => {
  return request({
    url: `/tag/${id}`,
    method: 'delete',
  })
}
